package com.touchlistenr.exam;

import com.example.touchsystemdemo.R;
import com.example.touchsystemdemo.R.layout;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;

public class TouchActivity extends Activity {
    boolean mChecked=false;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_touch);
		CheckBox checkBox=(CheckBox) findViewById(R.id.checkBox1);
		checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
			
			@Override
			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
				// TODO Auto-generated method stub
				mChecked=isChecked;
			}
		});
		MyTouchListener myTouchListener=new MyTouchListener();
		findViewById(R.id.radioButton1).setOnTouchListener(myTouchListener);
		findViewById(R.id.radioButton2).setOnTouchListener(myTouchListener);
		findViewById(R.id.radioButton3).setOnTouchListener(myTouchListener);
		
	}
	class MyTouchListener implements OnTouchListener{

		@Override
		public boolean onTouch(View v, MotionEvent event) {
			// TODO Auto-generated method stub
			return mChecked;
		}
		
	}
}

